﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KPIS.GERP.GFMS.MODEL;
using KPIS.GERP.GFMS.IBLL;
using KPIS.GERP.GFMS.IDAL;
using KPIS.GERP.GFMS.DALFactory;

// test only
using KPIS.GERP.GFMS.DAL;

namespace KPIS.GERP.GFMS.BLL
{
    public class B_FIM_Payments_Payinpack : IBLL_FIM_Payments_Payinpack
    {
        Common common = new Common();
        private static readonly IDAL_FIM_Payments_Payinpack dal = DataAccess.Create_FIM_Payments_Payinpack();
        //D_FIM_MAS_Receives r = new D_FIM_MAS_Receives();

        public B_FIM_Payments_Payinpack()
        {

        }

        public IList<M_FIM_Payments_Payinpack> GetFull(string bgm_source_seq
            , string bgm_year, string work_area_seq)
        {
            Nullable<int> nbgm_source_seq = common.ConvertNullInt(bgm_source_seq);
            Nullable<int> nbgm_year = common.ConvertNullInt(bgm_year);
            Nullable<int> nwork_area_seq = common.ConvertNullInt(work_area_seq);
            //Nullable<int> nevent_seq = common.ConvertNullInt(event_seq);
            return dal.GetFull(nbgm_source_seq, nbgm_year, nwork_area_seq);
        }

        //public IList<M_FIM_Payments> GetList(string bgm_source_seq
        //    , string bgm_year, string work_area_seq, string event_seq)
        //{
        //    Nullable<int> nbgm_source_seq = common.ConvertNullInt(bgm_source_seq);
        //    Nullable<int> nbgm_year = common.ConvertNullInt(bgm_year);
        //    Nullable<int> nwork_area_seq = common.ConvertNullInt(work_area_seq);
        //    Nullable<int> nevent_seq = common.ConvertNullInt(event_seq);
        //    return dal.GetList(nbgm_source_seq, nbgm_year, nwork_area_seq, nevent_seq);
        //}

        ////public string SelectRecentInsertedRoleSeq()
        ////{
        ////    return dal.SelectRecentInsertedRoleSeq();
        ////}

        //public M_FIM_Payments GetInfo(string seq)
        //{
        //    int nSeq;
 
        //    if (seq == null)
        //        return null;

        //    if (common.IsNumeric(seq))
        //    {
        //        nSeq = int.Parse(seq);
        //        return dal.GetInfo(nSeq);
        //    }
        //    else
        //    {
        //        return null;
        //    }
        //}

        //public M_FIM_Payments GetInfoFromMoneyReqSeq(string money_req_seq)
        //{
        //    int nSeq;

        //    if (money_req_seq == null)
        //        return null;

        //    if (common.IsNumeric(money_req_seq))
        //    {
        //        nSeq = int.Parse(money_req_seq);
        //        return dal.GetInfoFromMoneyReqSeq(nSeq);
        //    }
        //    else
        //    {
        //        return null;
        //    }
        //}

        //public IList<M_FIM_Payments> GetListFromPetition(string petition_seq)
        //{
        //    int nSeq;

        //    if (petition_seq == null)
        //        return null;

        //    if (common.IsNumeric(petition_seq))
        //    {
        //        nSeq = int.Parse(petition_seq);
        //        return dal.GetListFromPetition(nSeq);
        //    }
        //    else
        //    {
        //        return null;
        //    }
        //}

        public bool InsertList(IList<M_FIM_Payments_Payinpack> lst)
        {
            try
            {
               
                return dal.InsertList(lst);
            }
            catch
            {
                throw;
            }
        }

        public bool UpdateList(IList<M_FIM_Payments_Payinpack> lst)
        {
            try
            {

                return dal.UpdateList(lst);
            }
            catch
            {
                throw;
            }
        }

        public string Insert(M_FIM_Payments_Payinpack info)
        {
            try
            {
                return dal.Insert(info);
            }
            catch
            {
                throw;
            }
        }

        public void Update(M_FIM_Payments_Payinpack info)
        {
            try
            {
                dal.Update(info);
            }
            catch
            {
                throw;
            }
        }

        public void Delete2(M_FIM_Payments_Payinpack info)
        {
            try
            {
                dal.Delete2(info);
            }
            catch
            {
                throw;
            }
        }

        public void Delete(M_FIM_Payments_Payinpack info)
        {
            try
            {
                dal.Delete(info);
            }
            catch
            {
                throw;
            }
        }

        //public void ChangeStatus(M_FIM_Payments info)
        //{
        //    try
        //    {
        //        dal.ChangeStatus(info);
        //    }
        //    catch
        //    {
        //        throw;
        //    }
        //}

        //public void UpdateReceipt(M_FIM_Payments info)
        //{
        //    try
        //    {
        //        dal.UpdateReceipt(info);
        //    }
        //    catch
        //    {
        //        throw;
        //    }
        //}

        //public DataTable Report_SumUpPayment(string date)
        //{
        //    Nullable<DateTime> ddate = common.ConvertNullDateTime(date);
        //    return dal.Report_SumUpPayment(ddate);
        //}

       
        //public IList<M_FIM_Payments> GetNotRealPayment(string bgm_source_seq, string work_area_seq, string bgm_year, string method_seq)
        //{
        //    Nullable<int> nbgm_source_seq = common.ConvertNullInt(bgm_source_seq);
        //    Nullable<int> nwork_area_seq = common.ConvertNullInt(work_area_seq);
        //    Nullable<int> nbgm_year = common.ConvertNullInt(bgm_year);
        //    Nullable<int> nmethod_seq = common.ConvertNullInt(method_seq);
        //    return dal.GetNotRealPayment(nbgm_source_seq, nwork_area_seq, nbgm_year, nmethod_seq);
        //    //throw new NotImplementedException();
        //}

       
    }
}
